package com.juzhencms.apps.busi.service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.juzhencms.apps.base.busi.service.RemoteClientService;
import com.juzhencms.apps.base.common.config.Config;
import com.juzhencms.apps.base.common.database.DBTable;

@Service
@Async
public class CacheService extends CommonService{
	@Autowired
	private RemoteClientService remoteClientService;
	
	public Future<String> cleanCache(int siteId,String name) {
		Map param=new HashMap();
		param.put("names", name);
		remoteClientService.callAllBySiteId(siteId, "cacheServiceApi", "cleanCache", new Class[] {Map.class},new Object[] {param},Object.class);
		return new AsyncResult<String>("cleanCache");
	}

	public Future<String> cleanCache(int siteId,String name,String key) {
		Map param=new HashMap();
		param.put("name", name);
		param.put("key", key);
		remoteClientService.callAllBySiteId(siteId, "cacheServiceApi", "cleanCacheItemData", new Class[] {Map.class},new Object[] {param},Object.class);
		return new AsyncResult<String>("cleanCache");
	}
}
